<% img_urls.each_with_index do |(img_name, img_url), index| %>

  <div id="image_<%= index -%>" style="float:left; border: solid 1px silver; margin: 2px;">
  <div id="image_name_<%= index -%>" class="image_name"><%= img_name %></div>
  <div align="center">
  <% file_ext = img_name.downcase.split(".").last %>
  <% if ["flv", "swf"].include?(file_ext) %>
    <%= image_tag 'http://www.adobe.com/shockwave/download/images/flash_rune.gif', :alt => "flv形式の動画", :height => "70px" -%>
  <% elsif ["jpg","png","jpeg","gif","bmp"].include?(file_ext)%>
    <img src="<%= img_url %>" alt="<%= img_name %>" height='70'/>
  <% else %>
    <%= image_tag "question.gif", :alt => "不明なファイル形式", :height => "70px" -%>
  <% end %>
  </div>
  <div style="text-align:right;">
    <a href="#" id="remove_image_link_<%= index -%>" class="remove_image_link" >...[削除]</a>
  </div>
  </div>
<% end %>
<script type="text/javascript">
$j(function() {
    $j('.remove_image_link')
    .click(function() {
        var url = '<%= url_for :action => :ado_remove_image, :id => board_entry_id -%>';
        var filename = $j('#image_name_' + this.id.split('_')[3]).html();
        if(confirm('本当に削除しますか？')) {
            $j.ajax({
                url: url,
                data: {filename: filename},
                success: function(html) {
                    $j('#images').html(html);
                }
            });
        }
        return false;
    });
});
</script>
